package com.lzw.service.impl.supplier;

import com.lzw.mapper.supplier.SupplierLoginMapper;
import com.lzw.service.supplier.SupplierLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class SupplierLoginServiceImpl implements SupplierLoginService {

    @Autowired
    private SupplierLoginMapper supplierLoginMapper;

    @Override
    public boolean login(String username, String password) {
        return supplierLoginMapper.checkCredentials(username, password) != null;
    }

    @Override
    public Map<String, Object> getSupplier(String username, String password) {
        return supplierLoginMapper.getSupplier(username,password);
    }

    @Override
    public Map<String, Object> getSupplierById(Integer supplierId) {
        return supplierLoginMapper.getSupplierById(supplierId);
    }

    @Override
    public boolean updateSupplier(Integer supplierId, String name, String phone, String email) {
        return supplierLoginMapper.updateSupplier(supplierId, name, phone, email);
    }
}
